<%@page import="com.twistinjava.category.model.Category"%>
<%@page import="java.util.ArrayList"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
  <script type="text/javascript" src="/Admin/includes/checkCategory.js"></script>
<form name="crUser" method="post" action="/adminAction.do?method=saveSabCategory">
    <table width="680" cellpadding="0" cellspacing="0" border="0" style="padding-top: 50px;padding-left: 30px;">
        <tr>
            <td colspan="3">
                <font style="font-weight: bold;font-size: medium;" color="green">Create Sub Category</font>

            </td>

        </tr>
        <tr>
            <td colspan="3">
                <html:messages id="msg" message="true">
                    <font size="2">
                        ${msg} </font>
                    <br>
                </html:messages>

            </td>

        </tr>
        <tr>
            <td colspan="3">
                &nbsp;

            </td>

        </tr>
        <tr>
            <td>
                Category Name :<font color="red">*</font>
            </td>
            <td>
                    <%
                    ArrayList allCategory = (ArrayList) request.getAttribute("allCategory");

                    %>
                    <select id="catID" name="catID" style="width: 200px">
                    <option value="">Select</option>
                    <%
                    for(int i=0; i<allCategory.size(); i++)
                        {
                        Category category = (Category)allCategory.get(i);
                    %>
                    <option value="<%=category.getId()%>"><%=category.getCategoryName()%></option>
                    <%
                    }
                    %>
                </select>
                </td>
            <td width="300">&nbsp;</td>
        </tr>

        <tr>
            <td>
               Sub Category Name :<font color="red">*</font>
            </td>
            <td><input type="text" id="subCategoryName" name="subCategoryName" size="30" onchange="checkSubCategory()"></td>
            <td width="300" id="wait"></td>
        </tr>

        <tr>
            <td colspan="3" align="center"> <input type="submit" name="save" value="Save" onclick="return validateCategory();"></td>
        </tr>
    </table>
</form>
